﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EzDesk.Message.Model;
using EzDesk.EzAppApi.Utility.EzDeskAppApi;
using EzDesk.EzAppApi.Utility;

namespace EzDesk.Message.DesktopWeb.Extensions
{
    public static class ViewModelExtensions
    {
        static EzApiClient apiClient = new EzApiClient();

        public static SimpleUser GetSenderInfo(this SingleMessage message)
        {
            return apiClient.GetSimpleUserInfos(message.SenderId.ToString()).SingleOrDefault();
        }

        public static bool IsEmpty(this ParticipatorsInfo info)
        {
            return (info.UserParticipators == null || info.UserParticipators.Count == 0)
                && (info.GroupParticipators == null || info.GroupParticipators.Count == 0);
        }

    }
}